Trò chơi Angry Birds trong UNITY Engine
31.666 lượt xem;
1 using UnityEngine;
2 using System.Collections;
3
4
5 /// <summary>
6 /// base class for generic Quaternion props
7 /// </summary>
8 public abstract class AbstractQuaternionTweenProperty : AbstractTweenProperty
9 {
10 protected Transform _target;
11
12 protected Quaternion _originalEndValue;
13 protected Quaternion _startValue;
14 protected Quaternion _endValue;
15
16 public AbstractQuaternionTweenProperty()
17 {}
18
19
20 public AbstractQuaternionTweenProperty( Quaternion endValue, bool isRelative = false ) : base( isRelative )
21 {
22 _originalEndValue = endValue;
23 }
24
25
26 public override bool validateTarget( object target )
27 {
28 return target is Transform;
29 }
30
31
32 public override void prepareForUse()
33 {
34 if (_isRelative && !_ownerTween.isFrom)
35 _endValue = _startValue * _endValue;
36 }
37
38 }
2 using System.Collections;
3
4
5 /// <summary>
6 /// base class for generic Quaternion props
7 /// </summary>
8 public abstract class AbstractQuaternionTweenProperty : AbstractTweenProperty
9 {
10 protected Transform _target;
11
12 protected Quaternion _originalEndValue;
13 protected Quaternion _startValue;
14 protected Quaternion _endValue;
15
16 public AbstractQuaternionTweenProperty()
17 {}
18
19
20 public AbstractQuaternionTweenProperty( Quaternion endValue, bool isRelative = false ) : base( isRelative )
21 {
22 _originalEndValue = endValue;
23 }
24
25
26 public override bool validateTarget( object target )
27 {
28 return target is Transform;
29 }
30
31
32 public override void prepareForUse()
33 {
34 if (_isRelative && !_ownerTween.isFrom)
35 _endValue = _startValue * _endValue;
36 }
37
38 }